/*
 * Copyright (c) 2015 www.smarthome.com All rights reserved. 本软件源代码版权归----所有,未经许可不得任意复制与传播.
 */
package com.smarthome.base.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.smarthome.base.dao.ShResidenceDao;
import com.smarthome.base.dao.base.BaseDaoImpl;
import com.smarthome.domain.bean.ShResidence;

/**
 * ShResidenceDao 实现类
 * @author KongXiangyu
 * @since 2015-09-07
 */
@Repository("shResidenceDao")
public class ShResidenceDaoImpl extends BaseDaoImpl<ShResidence, Long> implements ShResidenceDao {

    private final static String NAMESPACE = "com.smarthome.base.dao.ShResidenceDao.";

    // 返回本DAO命名空间,并添加statement
    public String getNameSpace(String statement) {
        return NAMESPACE + statement;
    }

    @Override
    public List<ShResidence> queryShResidences(ShResidence residence) {
        // TODO Auto-generated method stub

        return this.selectList(getNameSpace("queryShResidence"), residence);
    }

    @Override
    public List<ShResidence> queryResidencesByUserId(Long userId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("userId", userId);
        return selectList(getNameSpace("queryResidencesByUserId"), map);
    }

    @Override
    public List<ShResidence> queryResidencesByAccountId(Long accountId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("accountId", accountId);
        return selectList(getNameSpace("queryResidencesByAccountId"), map);
    }
}